     ,,,
  
,,,,,,,,,,,,,,,,,,,,,
  
functions_bbcodeparse.php
  
include
,,,,,,,,,,,,,,,,,,,,,
   329  


  // ********************* REMOVE HTML CODES ***************************
  if (!$dohtml)
  {
    /*static $html_find = array('&lt;', '&gt;', '<', '>');
    static $html_replace = array('&amp;lt;', '&amp;gt;', '&lt;','&gt;');

    $bbcode = str_replace($html_find, $html_replace, $bbcode);*/
    $bbcode = htmlspecialchars_uni($bbcode);
    $html_allowed = false;
  } // end html


   :


  // Image Size hack r0.9
  // Added by SS to resize large pics and place link to full size pic

  // set max_imgsize to the max size you want pictures to be
  global $max_imgsize;
  $max_imgsize=480;

  // check for img tag and see if html is enabled
  if (strstr(strtolower($bbcode),'<img') AND $dohtml) {
    $tagstartcounter=0;
    do {
      $bbcodelength=strlen($bbcode);
      // pull tag from bbcode
      $tagopen=(strpos(strtolower($bbcode),'<img',$tagstartcounter));
      $tagclose=(strpos($bbcode,'>',$tagopen));
      $bbtag=substr($bbcode,$tagopen,($tagclose-$tagopen+1));
      $bbtag = str_replace('\'','"',$bbtag);

      // get link from bbtag
      $linkopen=(strpos(strtolower($bbtag),'<img'));
      $linkopen2=(strpos(strtolower($bbtag),'"',$linkopen));
      $linkclose=(strpos($bbtag,'"',$linkopen2+1));
      $link=substr($bbtag,$linkopen2+1,($linkclose-$linkopen2-1));

      // remove double spaces -- fixes issues with wordwrap
      $link = str_replace('  ', '', $link);

      // Check to see if image exists
      $image= ($link);

      // Get host url name for fsockopen to see if server is reachable
      $img_host=str_replace('http://','',$link);
      $img_host=substr($img_host,0,strpos($img_host,'/'));

      // set image found by default
      $image_found=true;

      // Check is server is reachable and timeout in 5 seconds if not
      if (@fclose(@fsockopen($img_host, 80, $fsockerr1, $fsockerr2, 5))) {
        // Check if image is on server
        if (@fclose(@fopen("$image", "r"))) {
          // Check image size and if oversize, change bbtag
          $img_width = getimagesize($link);
          if ($img_width[0] > $max_imgsize) {
            $bbtag = '<table><tr><td align="center"><a href="' . $link . '"><img src="'
              . $link . '" width="'.$max_imgsize.'" border="0"'.substr($bbtag,$linkclose+1,strlen($bbtag)-$linkclose+1).'<br>Picture has been resized, click for full size pic</a></td></tr></table>';
            }
          }
        else {
          // Image not found
          $bbtag='<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">Image link is broken</font></td></tr></table>';
          $image_found=false;
          }
        }
      else {
        // Server is down
        $bbtag='<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">Image server is down</font></td></tr></table>';
        $image_found=false;
        }


      // replace bbtag into bbcode
      $bbcode=substr($bbcode,0,$tagopen).$bbtag.substr($bbcode,$tagclose+1,$bbcodelength-$tagclose);

      // check if image was found to see what where to start the next search
      if ($image_found) {
        // move pointer back to img tag in case it moved
        $tagopen=$tagopen+(strpos(strtolower($bbtag),'<img'));
        }
      else {
        // move pointer back to img tag in case it moved
        $tagopen=$tagopen+(strpos(strtolower($bbtag),'id="image_found"'));
        }


      // start search from end of previous tag
      $tagstartcounter=(strpos($bbcode,'>',$tagopen));
      } while (strpos(strtolower($bbcode),'<img',$tagstartcounter));
    }

  // End Image Size hack r0.9


       1101   



return '<img src="' .  $link . '" border="0" alt="" />';

  


  // Image Size hack r0.9
  // Modified by SS to resize large pics and place link to full size pic
  // return '<img src="' .  $link . '" border="0" alt="" />';

  global $max_imgsize;

  $image= ($link);

  // Get host url name for fsockopen to see if server is reachable
  $img_host=str_replace('http://','',$link);
  $img_host=substr($img_host,0,strpos($img_host,'/'));

  // Check is server is reachable and timeout in 5 seconds if not
  if (@fclose(@fsockopen($img_host, 80, $fsockerr1, $fsockerr2, 5))) {
    // Check if image is on server
    if (@fclose(@fopen("$image", "r"))) {
      // Check image size and if oversize, change link
      $img_width = getimagesize($link);
      if ($img_width[0] > $max_imgsize) {
        $biglink = '<table><tr><td align="center"><a href="' . $link . '" ><img src="'
          . $link . '" width="'.$max_imgsize.'" border="0" alt=""><br>     </a></td></tr></table>';
        return $biglink;
        }
      else {
        return '<img src="' .  $link . '" border="0" alt="" />';
        }
      }
    else {
      // Image not found
      return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">  </font></td></tr></table>';
      }
    }
  else {
    // Server is down
    return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000"> ,,   </font></td></tr></table>';
    }

  // End Image Size hack r0.9


,,,,,,,,,,,,   ,,,,,,,,,,,,,,
   
    
$max_imgsize=480;

  
http://www.nabdh-alm3ani.net